<?php 
if(!isset($_SESSION)){session_start();}
require_once('Connections/tecno.php');
include('scripts/fechaMysqlNormal.php');

$idCli = $_SESSION['idCliente'];
mysql_select_db($database_tecno, $tecno);
$query_det_prod = "SELECT * FROM detallescliente WHERE id='$idCli' AND status <> 1 GROUP BY productoDes";
$det_prod = mysql_query($query_det_prod, $tecno) or die(mysql_error());
$row_det_prod = mysql_fetch_assoc($det_prod);
$totalRows_det_prod = mysql_num_rows($det_prod);


mysql_select_db($database_tecno, $tecno);
$query_bancos = "SELECT codBanco, banco FROM bancos ORDER BY banco ASC";
$bancos = mysql_query($query_bancos, $tecno) or die(mysql_error());
$row_bancos = mysql_fetch_assoc($bancos);
$totalRows_bancos = mysql_num_rows($bancos);
?>
<script type="text/javascript">
$(document).ready(function(){
	$("#fechaPago").datepicker();
	
	$("#enviar").click(function(){
		$.post('reportePago.php', $("#report").serialize(),function(data){	
			$("#tabs-3").html(data);	
		});	
		return false;
	});
});
</script>
<form name="report" id="report">
<table cellspacing="3" width="">
<tr>
		<td class='tituloTabla'>Producto</td>
		<td class='tituloTabla'>Fecha de pago</td>
		<td class='tituloTabla'>Monto</td>
        <td class='tituloTabla'>Forma</td>
        <td class='tituloTabla'>Banco</td>
        <td class='tituloTabla'>Nro</td>
</tr>
<tr class="rowTabla">      
        <td style="text-align:center;"><select name="producto" class="sel" id="producto">
                        <option value="0">Seleccione</option>
			    <?php do {  ?>
                        <option value="<?php echo $row_det_prod['idArt']; ?>"><?php echo $row_det_prod['productoDes']; ?></option>
    <?php } while ($row_det_prod = mysql_fetch_assoc($det_prod)); ?>
                      </select></td>
        <td style="text-align:center;">
    	<input name="fechaPago" type="text" class="input-peq" id="fechaPago" style="margin-left:5px; width:80px;" value="<?php echo date("d/m/Y"); ?>" readonly="readonly" /></td>  
        <td style="text-align:center;"><input name="montoPago" type="text" id="montoPago" size="7" /></td>
        <td style="text-align:center;">
        <select name="forma" class="sel" id="forma">
                      <option value="Seleccione" selected="selected">Seleccione</option>
                      <option value="Efectivo">Efectivo</option>
                      <option value="Cheque">Cheque</option>
                      <option value="Deposito">Dep&oacute;sito</option>
                      <option value="Transferencia">Transferencia</option>
                    </select>          
        </td>
        <td style="text-align:center;">
        	<select name="banco" class="" id="banco">
                      <option value="" selected="selected">Seleccione</option>
                      <?php do {  ?>
                      <option value="<?php echo $row_bancos['codBanco']?>"><?php echo $row_bancos['banco']?></option>
                      <?php } while ($row_bancos = mysql_fetch_assoc($bancos));
							  $rows = mysql_num_rows($bancos);
							  if($rows > 0) {
								  mysql_data_seek($bancos, 0);
								  $row_bancos = mysql_fetch_assoc($bancos);
							  }
							?>
                    </select>
        </td>
        <td style="text-align:center;"><input name="nro" type="text" id="nro" size="13" /></td>        
</tr>
<tr class="rowTabla">
  <td style="text-align:center;"><input name="cliente" type="hidden" id="cliente" value="<?php echo $idCli; ?>" /></td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">
  <input type="button" id="limpiarReporte" name="limpiarReporte" value="Limpiar" class="sendBtn" style="margin:0;"/></td>
  <td style="text-align:center;">
  <input type="submit" id="enviar" name="enviar" value="Enviar" class="sendBtn" style="margin:0;"/></td>
</tr>
<tr class="rowTabla">
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
  <td style="text-align:center;">&nbsp;</td>
</tr>
<tr class="rowTabla">
  <td colspan="6" style="text-align:center;"><div id="respuesta"></div></td>
  </tr>
</table>
</form>